package demo6;

/**
 * 懒汉式-静态内部类
 */
public class Singleton {
    // 私有构造方法
    private Singleton() {}
    // 静态变量声明，并没有赋值
    private static class SingletonHolder {
        private static final Singleton INSTANCE = new Singleton();
    }

    public static Singleton getInstance() {
        return SingletonHolder.INSTANCE;
    }
}
